#include "RIVIAProject.h"
#include "RIVIAEntityManager.h"
#include "RIVIAImage.h"
#include "RIVIALayer.h"

RIVIAProject::RIVIAProject() :
    m_pEntityManager(nullptr)
{
    m_pEntityManager = new RIVIAEntityManager();
}

RIVIAProject::~RIVIAProject()
{
    if(nullptr != m_pEntityManager)
    {
        delete m_pEntityManager;
        m_pEntityManager = nullptr;
    }
}

QImage RIVIAProject::getDisplayQImage()
{
    return m_pEntityManager->getCurImage()->getDisplayQImage();
}

void RIVIAProject::addImage(const cv::Mat &image)
{
    m_pEntityManager->newImage(image);
}

void RIVIAProject::addLayer(const cv::Mat &image)
{
    m_pEntityManager->getCurImage()->newLayer(image);
}

cv::Mat RIVIAProject::getCurMat()
{
    return m_pEntityManager->getCurImage()->getCurLayer()->getMat();
}

cv::Mat RIVIAProject::getCurMatProc()
{
    return m_pEntityManager->getCurImage()->getCurLayer()->getMatProc();
}

cv::Mat RIVIAProject::getCurAllMatProc()
{
    return m_pEntityManager->getCurImage()->getAllMats();
}

void RIVIAProject::updateImageByImageProc()
{
    m_pEntityManager->getCurImage()->getCurLayer()->updateMatByMatProc();
}

void RIVIAProject::deleteImageByID(int nID)
{
    m_pEntityManager->deleteImageByID(nID);
}

void RIVIAProject::deleteCurLayer()
{
    m_pEntityManager->getCurImage()->deleteCurLayer();
}

void RIVIAProject::setCurImageID(int nImageID)
{
    m_pEntityManager->setCurImageID(nImageID);
}

void RIVIAProject::setCurLayerID(int nLayerID)
{
    m_pEntityManager->getCurImage()->setCurLayerID(nLayerID);
}
